
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author camenesesg
 */
class DivisionOfNlognia {
    public static void main(String args[]) throws IOException {
        // Para leer desde teclado
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // Para leer desde archivo
//        BufferedReader br = new BufferedReader(new FileReader(new File("inDivisionOfNlognia.txt")));
        short K = Short.parseShort(br.readLine());
        short N, M, xx, yy, X, Y;
        while(K != 0) {
            String[] data = br.readLine().split("[ ]+");
            N = Short.parseShort(data[0]);
            M = Short.parseShort(data[1]);
            for (short i = 0; i < K; i++) {
                String[] data2 = br.readLine().split("[ ]+");
                X = Short.parseShort(data2[0]);
                Y = Short.parseShort(data2[1]);
                xx = (short) (X - N);
                yy = (short) (Y - M);
                if (xx > 0 && yy > 0) {
                    System.out.println("NE");
                } else if (xx > 0 && yy < 0) {
                    System.out.println("SE");
                } else if (xx < 0 && yy > 0) {
                    System.out.println("NO");
                } else if (xx < 0 && yy < 0) {
                    System.out.println("SO");
                } else {
                    System.out.println("divisa");
                }
            }
            K = Short.parseShort(br.readLine());
        }
//        br.close();
    }
        
    
}
